#ifndef RRPRIM_H
#define RRPRIM_H

#include "cstdio"
#include "rrmath.h"
#include "rrlight.h"
#include "rrray.h"

enum RRPRIMTYPE {RR_CUBOID, RR_PLANE, RR_QUADRIC};

class RRTracer;
class RRPrimSet;

class RRPrim
{
protected:
    RRTracer *parent;
    RRPrimSet *primset;
    RRPRIMTYPE type;
    bool reflection;
    bool transparency;
    RRVec3 size;
    RRVec3 coord;
    int reversal;
    RRVec4 amb;
    RRVec4 diff;
    float spec;
    RRLight light;
    RRVec3 cross;
    RRVec3 tosrc;

public:
    RRPrim();
    RRPRIMTYPE rrGetType();
    bool rrGetRef();
    bool rrGetTransp();
    RRVec3 rrGetSize();
    RRVec3 rrGetCoord();
    int rrGetRev();
    RRVec3 rrGetCross();
    RRVec4 rrGetAmb();
    RRVec4 rrGetdiff();
    float rrGetSpec();
    void rrSetPrimSet(RRPrimSet *arg);
    void rrSetPrim(RRPrim *arg);
    void rrSetPrim(bool ref, bool transp, RRVec3 s, RRVec3 c, int rev, RRVec4 a, RRVec4 d, float sp);
    void rrSetLight(RRLight arg);
    virtual float rrHit(RRRay arg) = 0;
    //virtual void rrCheckHit() = 0;
    virtual RRVec4 rrTrace() = 0;
};

#endif // RRPRIM_H
